/*
 * trace_CmdLoopExit.c
 *
 *  Created on: 2012/08/07
 *      Author: guanxiaoying
 */
#include "../table.h"
#include "../trace_cmd_table.h"
typedef struct _CMDLOOPEXIT
{
	AST			astPath;		/* 4 	*/
	AST			astNext;	/* 7 */
	AST         astParam;
	AST         astLoop;
} CMDLOOPEXIT, *PCMDLOOPEXIT;

#define TableSize  (sizeof(CMDLOOPEXIT ))
#define TableType  PCMDLOOPEXIT
#define stTable stCmdLoopExitManager.memoryBlocks
#define maxTable stCmdLoopExitManager.maxRecordNum
#define  maxNumPerBlk  (stCmdLoopExitManager.astMaxNum_Block)


static TABLEMANAGER stCmdLoopExitManager = {
//		U4                  usIdx;
		0,
//		PSZ				    con_pszName;    constant
		__FILE__,
//		U2					con_usSize;		constant
		TableSize,
//		U2					block_num;	　　　　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_Block;     １回設定のみ
		0,
//		S4					astTabNum_LastPage; 　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_LastPage;     Reset clear  際　要
		0,
//		U4					ulMaxByte;	　　　　　　　　　　クリアしない
		0,
//		U4					con_minPageSize;　　　　　　　　　　constant
		0
};
static VOID resetListener( U4  procid, U2 index )
{
	if( procid == stCmdLoopExitManager.u4Idx )
	{
		if( index > 0 && index < MAX_VOLUMN_OF_TABLE )
		{
			stTable[ index-1] = NULL;
		}
	}
}
static TableType core_getTable( AST index )
{
	TableType temp = (TableType)Check_Com( &stCmdLoopExitManager, resetListener,  index );
	if( temp != NULL ){ return &temp[index%maxNumPerBlk]; } return NULL;
}
static BOOL ClearTable( VOID )
{
	return Clear_Com( &stCmdLoopExitManager );
}
static BOOL AllocTable( AST astReqArg )
{
	return AllocTable_Com( &stCmdLoopExitManager, astReqArg, resetListener );
}
static AST getMaxLineNum( VOID ){
	return maxTable;
}

static AST getPath( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPath;
}
static AST setPath( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPath=value;
}
static AST getPathNext( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNext;
}
static AST setPathNext( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNext=value;
}
static AST getParam( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astParam;
}
static AST setParam( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astParam=value;
}
static AST getLoop( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoop;
}
static AST setLoop( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoop=value;
}
const CMDLOOPEXITACCESS stCmdLoopExitAccess ={
		ClearTable,
		AllocTable,
		getMaxLineNum,

		{
				getPath,
				setPath
		},
		{
				getPathNext,
				setPathNext
		},
		{
				getParam,
				setParam
		},
		{
				getLoop,
				setLoop
		}

};



